class CategoriesController < ApplicationController
  before_filter :authorize
  layout "newscategories"  
  active_scaffold :category do |config|
      config.label = "Category 1"
      config.columns = [:name,:websitesinf]
config.list.columns =  [:name,:websitesinf]

  end
  
  def destroy
    @cat1obj = Category.find(params[:id])
    super

    @wsurln = Websitesinf.find(@cat1obj.websitesinf_id).url1	    
    s_wsaddr = ""    
      case @wsurln.downcase
        when "www.deathtoglamour.com" : 
              s_wsaddr = "http://84.234.17.41:3009/"+"backend/api"
                                             
        else 
              s_wsaddr = ""
        
      end     
    

     blog = ActionWebService::Client::Soap.new(ArticleApi, s_wsaddr)

 		  		 blog.del_cat1(@cat1obj.name)  

  end  
  
	def before_update_save(record); 
    @cat1obj = Category.find(record.id)
		  
    @wsurln = Websitesinf.find(@cat1obj.websitesinf_id).url1			  
    s_wsaddr = ""    
      case @wsurln.downcase
        when "www.deathtoglamour.com" : 
              s_wsaddr = "http://84.234.17.41:3009/"+"backend/api"
                                             
        else 
              s_wsaddr = ""
        
      end 
     blog = ActionWebService::Client::Soap.new(ArticleApi, s_wsaddr)
 		 blog.upd_cat1(@cat1obj.name,params[:record][:name])  	
 	end  
 	
	def after_create_save(record); 
    @cat1obj = Category.find(record.id)
		  
    @wsurln = Websitesinf.find(@cat1obj.websitesinf_id).url1			  
    s_wsaddr = ""    
      case @wsurln.downcase
        when "www.deathtoglamour.com" : 
              s_wsaddr = "http://84.234.17.41:3009/"+"backend/api"
                                             
        else 
              s_wsaddr = ""
        
      end 
     blog = ActionWebService::Client::Soap.new(ArticleApi, s_wsaddr)
 		 blog.ins_cat1(@cat1obj.name)  	
 	end 	
end
